

import 'package:flutter/material.dart';
import 'package:test_flutter/common/style/common_style.dart';

/// 首页抽屉
class HomeDrawerWidget extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return Drawer(
      child: ListView(
        children: <Widget>[
//          UserAccountsDrawerHeader(
//            accountName: Text('czhah'),
//            currentAccountPicture: CircleAvatar(
//              backgroundImage: AssetImage("static/images/ic_logo.png"),
//            ),
//            arrowColor: UIColors.common_color_black1,
//          ),
          SafeArea(/// 控制不被状态栏或底部导航栏挡住
            child: Container(
              height: 100,
              width: double.infinity,
              padding: EdgeInsets.only(left: 10, top: 10),
              color: UIColors.common_color_black1,
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start, /// 控制行内子控件左对齐
                children: <Widget>[
                  ClipOval(/// 控制显示圆形图片
//                  child: Image.network("https://avatars3.githubusercontent.com/u/12592684?v=4", width: 50, height: 50,),
                    child: Image.asset("static/images/ic_logo.png", width: 44, height: 44,),
                  ),
                  Padding(
                    padding: EdgeInsets.only(top: 4),
                    child: Container(
                      width: 44,
                      alignment: Alignment.center,
                      child: Text('czhah', style: TextStyle(color: UIColors.common_color_white)),
                    ),
                  ),
                ],
              ),
            ),
          ),
          ListTile(
            title: Text('问题反馈'),
            onTap: () => {
              print("问题反馈"),
              Navigator.pop(context)
            },
          ),
          ListTile(
            title: Text('阅读历史'),
            onTap: () => {
              print("阅读历史"),
              Navigator.pop(context)
            },
          ),
          ListTile(
            title: Text('个人信息', style: TextStyle(fontWeight: FontWeight.bold),),
            onTap: () => {
              print("个人信息"),
              Navigator.pop(context)
            },
          ),
          ListTile(
            title: Text('语言切换'),
            onTap: () => {
              print("语言切换"),
              Navigator.pop(context)
            },
          ),
          ListTile(
            title: Text('检测更新'),
            onTap: () => {
              print("检测更新"),
              Navigator.pop(context)
            },
          ),
          ListTile(
            title: Text('关于'),
            onTap: () => {
              print("关于"),
              Navigator.pop(context)
            },
          ),
          Container(
            margin: EdgeInsets.only(left: 10, right: 10),
            child: TextButton(
              child: Text('退出登录', style: TextStyle(color: UIColors.common_color_white),),
              style: ButtonStyle(
                backgroundColor: MaterialStateProperty.all(UIColors.common_color_red2)
              ),
              // splashColor: UIColors.common_color_red3, /// 水波纹的颜色
              // highlightColor: UIColors.common_color_red3, /// 按下的颜色
              // color: UIColors.common_color_red2, /// 默认颜色
              onPressed: () => {
                print("退出登录")
                /// 这里要退出而且跳转登录页面
              },
            ),
          )
        ],
      ),
    );
  }
}
